#include "fifo.hpp"

#define FIFO_FILE "fifo"

int main()
{
    int fd = open(FIFO_FILE,O_WRONLY);

    if(fd < 0)
    {
        perror("OPEN FAIL!");
        exit(1);
    }

    std::string message;

    int i = 0;

    while(true)
    {
        std::getline(std::cin,message);
        message += "[" + std::to_string(i) + "]";
        write(fd,message.c_str(),message.size());
        message.clear();
        ++i;
    }

    close(fd);

    return 0;
}